/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.aurelius.testngexecutionlogger;

import java.util.Date;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jms.core.JmsTemplate;
import org.testng.annotations.Test;

/**
 *
 * @author Lukasz
 */
public class ActivemqStarter {

    @Test
    public void test() throws InterruptedException {

        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("activemq.xml");

        JmsTemplate jmsTemplate =
                applicationContext.getBean("jmsTemplate", JmsTemplate.class);

        for (int counter = 0; counter < 30; counter++) {

            System.out.println("Sending" + counter);
            jmsTemplate.convertAndSend("Message nr " + counter + " date : " + new Date().toString());

            Thread.sleep(4000);
        }
    }
}
